<?php
/**
 * Created by PhpStorm.
 * User: ly
 * Date: 2017\12\14 0014
 * Time: 14:33
 */
?>

<style type="text/css">

    /** 联想搜索 **/
    #province + .select2-container .select2-selection{height: 32px;}
    .select2-results__message{display: none;}
</style>

    <div class="perfect-logo">
        <img src="/image/officeHall/uploadAssetPackage/wsxx.png" class="pull-left">
        <span class="pull-left">基本信息</span>
    </div>
    <form class="form-horizontal" id="infoForm">
        <div class="form-group">
            <label for="inputText1" class="pull-left control-label">资产包名称<i style="color: red">*</i></label>
            <div class="pull-left label-div">
                <input type="text"  class="form-control" id="titlename" name="titlename" required="true" onkeyup="true" value="<?PHP echo $data['title']?>"  placeholder="请输入资产包名称（建议命名规则：地区+持包人简称+户数+本金）" onfocus="this.placeholder=''"  onblur="this.placeholder='请输入资产包名称（建议命名规则：地区+持包人简称+户数+本金）'">
                <span style="display: none;">请输入资产包名称（建议命名规则：地区+持包人简称+户数+本金） </span>
            </div>
        </div>
        <!-- 2 -->
<!--        <div class="form-group">-->
<!--            <label class="pull-left control-label">公开部门</label>-->
<!--            <div class="pull-left label-div label-div2">-->
<!--                <p class="form-control-static">--><?php //echo $data['access_users'];?><!--</p>-->
<!--            </div>-->
<!--        </div>-->
        <!-- 3 -->
        <div class="form-group">
            <label for="" class="pull-left control-label">资产包类型</label>
            <div class="pull-left label-div" id="typename">
                <button type="button" class="btn <?php echo $data['type']==1?'btn-primary':'btn-default';?> perfect-information-btn btns-primary" typeid="1">保证类</button>
                <button type="button" class="btn <?php echo $data['type']==2?'btn-primary':'btn-default';?> perfect-information-btn btns-primary" typeid="2">抵押类</button>
                <button type="button" class="btn <?php echo $data['type']==3?'btn-primary':'btn-default';?> perfect-information-btn btns-primary" typeid="3">混合类</button>
            </div>
        </div>
        <!-- 4 -->
        <div class="form-group">
            <label for="inputText4" class="pull-left control-label">持包人名称<i style="color: red">*</i></label>
            <div class="pull-left label-div">
                <input type="text" class="form-control"   id="creditorname" name="creditorname" onkeyup="true" value="<?php echo $data['creditor']?>">
            </div>
        </div>
        <!-- 5 -->
        <div class="form-group">
            <label for="inputText5" class="pull-left control-label">省份地区<i style="color: red">*</i></label>
            <div class="pull-left label-div">
                <select class="pull-left form-control area-select" required="true" name="province" onchange="select_change(this.options[this.options.selectedIndex].value)" id="province">
                    <option value="">--请选择省--</option>
                    <?php
                    if(count($data['countrylist']['province'])>0){
                        foreach($data['countrylist']['province'] as $val){//selected = "selected"
                            if($val['id']==$data['province']){
                                $selectedFlag='selected = "selected"';
                            }else{
                                $selectedFlag='';
                            }
                            echo '<option value="'.$val['id'].'" '.$selectedFlag.'>'. $val['title'].'</option>';
                        }
                    }
                    ?>
                </select>
                <select class="pull-left form-control area-select2" multiple name="city" id="city">

                    <?php
                    if ($data['city'] == 0) {
                        $city = '<option selected value="0">--请选择城市--</option>';
                    } else {
                        $city = '<option value="0">--请选择城市--</option>';
                    }

                    if (!empty($data['countrylist']['city']) && is_array($data['countrylist']['city'])) {
                        $cityData = explode(',', $data['city']);
                        foreach ($data['countrylist']['city'] as $val) {
                            if ($val['id'] > 0) {
                                if (in_array($val['id'], $cityData)) {
                                    //if ($val['id'] == $data['city']) {
                                    $city .= '<option selected value="' . $val['id'] . '">' . $val['title'] . '</option>';
                                } else {
                                    $city .= '<option value="' . $val['id'] . '">' . $val['title'] . '</option>';
                                }
                            }
                        }
                    }
                    echo $city;
                    ?>

                </select>
            </div>
        </div>
        <!-- 6 -->
        <div class="form-group">
            <label for="inputTex6" class="pull-left control-label">本金（元）<i style="color: red">*</i></label>
            <div class="pull-left label-div">
                <input type="text" class="form-control" id="principal" name="principal" required="true"  isNumber="true" onkeyup="true" value="<?php echo $data['principal']?>">
            </div>
        </div>
        <!-- 7 -->
        <div class="form-group">
            <label for="inputText7"  class="pull-left  control-label">利息（元）</label>
            <div class="pull-left label-div">
                <input type="text"  class="form-control" id="interest" name="interest"  isNumber="true" onkeyup="true" value="<?php echo $data['interest']?>">
            </div>
        </div>
        <!-- 8 -->
        <div class="form-group">
            <label for="inputText8" class="pull-left control-label">剩余户数<i style="color: red">*</i></label>
            <div class="pull-left label-div">
                <input type="text"  class="form-control" id="hushu" name="hushu" required="true"  isNumber="true" onkeyup="true" value="<?php echo $data['hushu']?>">
            </div>
        </div>
        <!-- 9 -->
        <div class="form-group">
            <label for="" class="pull-left control-label">未诉债权时效 </br>及催收方式</label>
            <div class="pull-left label-div label-div2">
                <textarea class="form-control textarea-edit" style="min-height: 34px;"  id="limit_collection" ><?php echo $data['limit_collection']?></textarea>
            </div>
        </div>
        <div class="form-group">
            <label for="" class="pull-left control-label">资产包信息来源</label>
            <div class="pull-left label-div label-div2">
                 <textarea class="form-control textarea-edit" style="min-height: 34px;"  id="origin" ><?php echo $data['origin']?></textarea>
            </div>
        </div>
        <div class="form-group">
            <label for="inputText9" class="pull-left  control-label">其他补充</label>

            <div class="pull-left label-div label-div2">
                <textarea class="form-control textarea-edit" style="min-height: 94px;"   id="detail" ><?php echo $data['detail']?></textarea>
            </div>
        </div>
        <!-- 10 -->
        <div class="btns">
            <button type="button" class="btn btn-primary perfect-information-btn btns-primary btns-primary-save pull-right" id="sumitpackageinfo">保存</button>
            <button type="reset"  class="btn btn-default perfect-information-btn btns-primary btns-primary-del pull-right" id="cancelpackageinfo">取消</button>
        </div>
    </form>


    <script type="text/javascript">
        $(function(){
            // input 占位符显示问题
            $("input").focus(function(){
              $(this).siblings("span").show();
            });

            $("input").blur(function(){
              $(this).siblings("span").hide();
            });
            
//          前端验证
			 $.validator.setDefaults({
				   debug: true
				})
		     $("#infoForm").validate({});

            //城市select2
            $(document).ready(function(){
                $('#city').select2({
                    language: "zh-CN",  //设置 提示语言
                    width: '240px', //设置下拉框的宽度
                    tokenSeparators: [',', ' '],
                    placeholder: "请选择城市",  //提示语
                    maximumSelectionLength :30,   //限制搜索的个数
                    tags: false                //可以手动添加，若限制手动添加，设置为false
                })
            });

            $('#province').select2({
                language: "zh-CN",  //设置 提示语言
                width: '240px', //设置下拉框的宽度
                tokenSeparators: [',', ' '],
                placeholder: "请选择省",  //提示语
                //maximumSelectionLength :30,   //限制搜索的个数
                tags: false                //可以手动添加，若限制手动添加，设置为false
            })
        });
    </script>
